IntelliJ Configuration

Preparation: Install IntelliJ

  1. Get a JetBrains Ultimate License. For students: Visit https://www.jetbrains.com/student.

  2. Install JetBrains Toolbox: choco install jetbrainstoolbox and choco pin add -n jetbrainstoolbox, because JetBrains does an auto update

  3. Install “IntelliJ IDEA Ultimate” using the JetBrains Toolbox.

Preparation: Build Winery

Build Winery to have all dependencies fetched by Maven: mvn clean install -DskipTests.

Setup IntelliJ

  1. At start of IntelliJ, browse to the root pom.xml and open it as project.

  2. Enable checkstyle: Follow the shown steps and apply them in IntelliJ ../../_images/activate-checkstyle.gif

    • Install the IntelliJ Checkstyle Plugin. It can be found via plug-in repository (Settings -> Plugins -> Browse repositories)

    • Open the Settings (by pressing Ctrl + Alt + S)

    • Go to Other Settings -> CheckStyle.

    • Click on the green plus and add checkstyle.xml from the root of the Winery code repository.

  3. Configure the code style

    1. Open the Settings (by pressing Ctrl + Alt + S)

    2. Go to “Editor > Code Style”

    3. Click “Manage…” (right of “Scheme:”)

    4. Click “Import Scheme”

    5. Choose “IntelliJ IDEA code style XML”

    6. Navigate to intellij-idea-code-style.xml. It is located in docs/config/IntelliJ IDEA.

    7. Press “OK”

    8. You will see a message “Winery configuration settings were imported”.

    9. Press “OK”

    10. Press “Close”

    11. Press “OK”

  4. Setup code headers to be inserted automatically

    1. Open the Settings (by pressing Ctrl + Alt + S)

    2. Go to Editor > Copyright > Copyright Profiles

    3. Click the green plus

    4. Name “Winery”

    5. Copyright text from Source Code Headers

    6. Go to Editor > Copyright > Formatting

    7. Adjust copyright formatting settings

      • Change to Use block comments with Prefix each line

      • Set Relative Location to Before other comments

      • Increase Separator before/after Length to 81

      • GitAutoCheck

    8. Go to Editor > Copyright

    9. Set “Winery” as Default project copyright

    10. Press “OK”

  5. Setup Apache Tomcat

    1. Download Tomcat 9.0 from https://tomcat.apache.org/download-90.cgi. Choose “zip” (e.g., http://mirror.synyx.de/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.zip).

    2. Extract it to c:\apache. Result: C:\apache\apache-tomcat-9.0.7.

    3. ../../_images/run-step1-edit-configuration.png

    4. ../../_images/run-step2-add-new-configuration.png

    5. ../../_images/run-step3-add-tomcat.png

    6. ../../_images/run-step4-configure-tomcat-button.png

    7. config/IntelliJ IDEA/figures/run-step5-add-appserver-button.png.png

    8. ../../_images/run-step6-set-apache-tomcat-directory.png

    9. Press OK
      ../../_images/run-step7-confirm.png

    10. Set name and no browser launch:
      ../../_images/run-step8-name-and-no-browser.png

    11. Add deployment artifacts:
      ../../_images/run-step9-button-add-deployment-artifacts.png

    12. ../../_images/run-step10-choose-artifact.png

    13. ../../_images/run-step11-select-artifcat.png

    14. Set /winery as application context:
      ../../_images/run-step12-set-winery-as-application-context.png

    15. Click “Apply”

  6. Setup npm run for TOSCA Management UI

    1. ../../_images/run-repositoryui-step1-add-npm-config.png

    2. ../../_images/run-repositoryui-step2-configure.png

  7. Setup npm run for Topology Modeler

    1. ../../_images/run-topologymodeler-step1-add-npm-config.png

    2. ../../_images/run-topologymodeler-step2-configure.png

  8. Setup npm run for Workflowmodeler (BPMN4TOSCA Modeler)

    1. ../../_images/run-topologymodeler-step1-add-npm-config.png

    2. ../../_images/run-workflowmodeler-step2.png

  9. Optional: Setup XSD validation for TOSCA files

    1. Open the Settings (by pressing Ctrl + Alt + S)

    2. Go to “Languages & Frameworks”

    3. Select “Schemas and DTDs”

    4. Click on the plus on the right at “External Schemas and DTDs”

    5. Enter http://docs.oasis-open.org/tosca/ns/2011/12 as URI

    6. In “Project Schemas” search for TOSCA-v1.0.xsd. It should be located at “org.eclipse.winery.common”.
      In the case of opening C:\winery-repository in IntelliJ, you have to select enter C:\git-repositories\winery\org.eclipse.winery.common\src\main\resources\TOSCA-v1.0.xsd in the Field “File”

    7. Click “OK”.

    8. Go to “Editor”

    9. Select “File Types”

    10. At “Recognized File Types”, scroll down to XML

    11. Select “XML”

    12. At “Registered Patterns”, click on the Plus

    13. Enter *.tosca in the popup.

    14. Click “OK”

    15. Click “OK”

  10. Optional: In case you do not want to have the live-update of Angular, you build the WARs of the UI and then deploy as follows:

    • External artifact .../org.eclipse.winery.frontends/target/tosca-management.war to /

    • External artifact .../org.eclipse.winery.frontends/target/topologymodeler.war to /winery-topology-modeler

    • External artifact .../org.eclipse.winery.frontends/target/workflowmodeler.war to /winery-workflowmodeler

  11. Run everything

    • Select “Winery - REST”. Click on “Play” (the green rectangle)

    • Select “TOSCA Mangement UI”. Click on “Play”

    • Select “Topolgoy Modeler”. Click on “Play”.

    • Open http://localhost:4200 in your browser.

  12. Demonstration: Open winery-repository (AKA tosca-definitions) in IntelliJ
    This ensures that you can work with the TOSCA files using the IDE.

    1. Go to File -> Open…

    2. Enter c:\winery-repository

    3. Click “OK”

    4. At the dialog “Open Project” choose “New Window”

    5. Expand winery-repository (on the left side)

    6. Expand nodetypes

    7. Expand http%3A%2F%2Fplain.winery.opentosca.org%2Fnodetypes

    8. Expand NodeTypeWithTwoKVProperties

    9. Double click NodeType.tosca

    10. Go to line 14

    11. Type in <

    12. See that <tosca:CapabilityDefinitions and other tosca elements are proposed

    13. No further action required. You can close the window.

Further Remarks

  • Please let .editorconfig override the settings of IntelliJ

  • Shortcuts

    • 2x Shift / Ctrl+Shift+F / Ctrl+F: Differrent forms of search

    • Ctrl+Alt+L: Organize imports (fixes checkstyle)

    • Ctrl+X: if nothing is marked: cut line (equal to marking whole line and using Ctrl+X)

    • Ctrl+Shift+T: Create/jump to the test class

  • See Update Copyright Header for updating old copyright headers